import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:verse_systems/res/colors.dart';
import 'package:verse_systems/utils/image_utils.dart';
import 'package:verse_systems/widgets/drawer_appbar.dart';

class AuthenticationPoint extends StatefulWidget {
  const AuthenticationPoint({super.key});

  @override
  State<AuthenticationPoint> createState() => _AuthenticationPointState();
}

class _AuthenticationPointState extends State<AuthenticationPoint> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colours.system_background_color,
        appBar: const DrawerAppbar(
          title: '提示',
        ),
        body: SingleChildScrollView(
            child: Container(
          color: Colours.app_main_color,
          width: MediaQuery.of(context).size.width,
          height: MediaQuery.of(context).size.height,
          child: Column(
            children: [_information, _positiv, _wrap],
          ),
        )));
  }

  Widget get _information {
    return Container(
      margin: EdgeInsets.fromLTRB(30.w, 15.w, 30.w, 24.w),
      padding: EdgeInsets.symmetric(vertical: 10.w, horizontal: 5.w),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.all(Radius.circular(8.w)),
        color: Colours.app_text_line_color,
      ),
      child: Text("place_the_document".tr,
          style: TextStyle(
              color: Colours.calendar_open_text_color,
              fontSize: 14.sp,
              height: 1.5)),
    );
  }

  Widget get _positiv {
    return Stack(
      children: [
        Container(
          width: 276.w,
          height: 180.w,
          decoration: BoxDecoration(
            image: DecorationImage(
                image: ExactAssetImage(ImageUtils.getImgPath("positiv_point")),
                fit: BoxFit.fill),
          ),
        ),
        Positioned(
            bottom: 0,
            right: 0,
            child: Image.asset(
              ImageUtils.getImgPath("iconv_point"),
              fit: BoxFit.fill,
              width: 25.w,
              height: 25.w,
            )),
      ],
    );
  }

  Widget get _wrap {
    return Container(
      margin: EdgeInsets.fromLTRB(0, 36.w, 0, 0.w),
      child: Wrap(
        spacing: 30.w,
        runSpacing: 25.w,
        children: _wrapList,
      ),
    );
  }


  List<Widget> get _wrapList {
    return [
      {"title": "lens_out_focus".tr, "path": ImageUtils.getImgPath("blur_point")},
      {"title": "glisten_and_bright".tr, "path": ImageUtils.getImgPath("glisten_point")},
      {"title": "incomplete".tr, "path": ImageUtils.getImgPath("incomplete_point")},
      {"title": "temporary_documents".tr, "path": ImageUtils.getImgPath("temporary_point")},
    ].map((val) {
      return InkWell(
          onTap: () async {
            debugPrint("点击${val["title"]}");
          },
          child: SizedBox(
            width: 140.w,
            height: 122.w,
            child: Column(
              children: [
                Container(
                  alignment: const Alignment(1.0, 1.0),
                  width: 140.w,
                  height: 92.w,
                  decoration: BoxDecoration(
                    image: DecorationImage(
                        image: ExactAssetImage(
                          val["path"].toString(),
                        ),
                        fit: BoxFit.fill),
                  ),
                  child: Image.asset(
                    ImageUtils.getImgPath("error_point")
                  ),
                ),

                Container(
                  alignment: Alignment.center,
                  width: 140.w,
                  height: 30.w,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.only(
                        bottomLeft: Radius.circular(6.w),
                        bottomRight: Radius.circular(6.w)),
                    color: Colours.app_main_text_color,
                  ),
                  child: Text(val["title"].toString(),
                      style: TextStyle(
                        color: Colours.app_main_color,
                        fontSize: 14.sp,
                      )),
                )
              ],
            ),
          ));
    }).toList();
  }
}
